import mockjs from 'mockjs'
import { MockMethod } from 'vite-plugin-mock'

export default [
  {
    url: '/api/login',
    method: 'post',
    response: ({ body }) => {
      const { username, password } = body
      if (username === 'admin' && password === '123456') {
        return {
          code: 200,
          message: '登录成功',
          data: {
            token: 'admin', // 模拟生成的登录 token
            userInfo: '这个是用户信息',
          },
        }
      } else {
        return {
          code: 400,
          message: '用户名或密码错误',
          data: null,
        }
      }
    },
  },
] as MockMethod[]
